Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

escaped "." in regex for ipv4 Validation #56

Merged
merged 1 commit into from
Feb 17, 2016
Merged

escaped "." in regex for ipv4 Validation #56

merged 1 commit into from
Feb 17, 2016

Conversation

BlckStar
Copy link

@BlckStar BlckStar commented Feb 3, 2016

"." was not literal dot but any-char , IP "11111111111" was valid

weierophinney added a commit to weierophinney/zend-validator that referenced this pull request Feb 17, 2016
weierophinney added a commit to weierophinney/zend-validator that referenced this pull request Feb 17, 2016
@weierophinney
Copy link
Member

We need unit tests to validate the change; can you please provide some, @BlckStar ?

@weierophinney
Copy link
Member

I've written unit tests. Interestingly, while the regex is incorrect, that fact does not result in false positives. The reason is because we then call ip2long() on the resultant value, which ends up invalidating the value. 111111111111 ends up invalid under the current code.

I'll still merge the change, as we should be escaping the . to ensure it's matched literally.

@weierophinney weierophinney merged commit 8f83fea into zendframework:master Feb 17, 2016
weierophinney added a commit that referenced this pull request Feb 17, 2016
escaped "." in regex for ipv4 Validation
weierophinney added a commit that referenced this pull request Feb 17, 2016
Added tests to verify that malformed IP addresses are flagged as
invalid. Interestingly, the "fix" presented in #56 doesn't change the
operation of the validator; this is because the value is passed to
`ip2long()`, which returns boolean false due to invalid input.

That said, the changes make sense; the `.` character should be a literal
match, and not a wildcard.
weierophinney added a commit that referenced this pull request Feb 17, 2016
weierophinney added a commit that referenced this pull request Feb 17, 2016
weierophinney added a commit that referenced this pull request Feb 17, 2016
@weierophinney weierophinney added this to the 2.5.4 milestone Feb 17, 2016
@weierophinney weierophinney self-assigned this Feb 17, 2016
weierophinney added a commit to weierophinney/zend-validator that referenced this pull request Feb 17, 2016
@BlckStar
Copy link
Author

Okay thanks, was stumbling over this. Sry i am kind of new at github and doing a pull request for the first time. But unit test sounds good. I will remember this.

Von Outlook Mobile gesendet

On Wed, Feb 17, 2016 at 9:08 AM -0800, "weierophinney" notifications@github.com wrote:

Merged #56.


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants